#include "StdAfx.h"
#include "GraphicShowVideo.h"

IMPLEMENT_DYNAMIC(GraphicShowVideo,CWnd)

GraphicShowVideo::GraphicShowVideo(void)
{
}

GraphicShowVideo::~GraphicShowVideo(void)
{
}
BEGIN_MESSAGE_MAP(GraphicShowVideo, CWnd)
	ON_WM_CREATE()
	ON_WM_SIZE()
	ON_WM_ERASEBKGND()
END_MESSAGE_MAP()

int GraphicShowVideo::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_stcShowVideo.Create(_T(""),WS_CHILD | WS_VISIBLE,CRect(0,0,0,0),this,IDC_STATIC_PLAY_AREA);
	m_stcShowVideo.ShowWindow(SW_SHOW);



	return 0;
}

void GraphicShowVideo::OnSize(UINT nType, int cx, int cy)
{
	CWnd::OnSize(nType, cx, cy);

	// TODO: Add your message handler code here
	CWnd *parent = GetParent();
	CRect rect;
	this->GetWindowRect(&rect);
	parent->GetClientRect(&rect);
	CRect rtViewArea(rect.left,rect.top,rect.right, rect.bottom-rect.top);
	m_stcShowVideo.SetWindowPos(parent,rtViewArea.left,rtViewArea.top, rtViewArea.right, rtViewArea.bottom, SWP_NOZORDER);
	
}

BOOL GraphicShowVideo::OnEraseBkgnd(CDC* pDC)
{
	// TODO: Add your message handler code here and/or call default
	//CRect rect;
	//GetClientRect(&rect);
	//CBrush myBrush(RGB(255,0,0)/*COLOR_SHOW_VIDEO_AREA*/);    // dialog background color
	//CBrush *pOld = pDC->SelectObject(&myBrush);
	//BOOL bRes  = pDC->PatBlt(0, 0, rect.Width(), rect.Height(), PATCOPY);
	//pDC->SelectObject(pOld);    // restore old brush
	//return bRes;


	return CWnd::OnEraseBkgnd(pDC);
}
